<?php 

header("Content-type: text/html; charset=utf-8"); 

function abc($num)
{
	for ($i=100; $i <=$num ; $i++) { 
		if($i%3==1 && $i%4==1 && $i%5==1){
			echo $i."<br>";
		}
	}
}
/**
 * [Ctime 时间格式的转换]
 * @Author   Xuebingsi
 * @DateTime 2017-07-10T08:19:55+0800
 * @param    [时间戳]                   $time [需要转换的时间戳]
 */
function Ctime($time=null)
{
	if($time==null){
		return date("Y-m-d H:i:s");
	}
	
	$diff = time()-$time;

	if($diff<60){
		return "刚刚";
	}elseif($diff<3600){
		return ceil(($diff/60))."分钟前";
	}elseif($diff<86400){
		return ceil(($diff/3600))."小时前";
	}elseif($diff<(86400*7)){
		return ceil(($diff/86400))."天前";
	}else{
		return date("Y-m-d H:i:s",$time);
	}
}
/**
 * [F 转存储单位]
 * @Author   Xuebingsi
 * @DateTime 2017-07-13T09:27:28+0800
 * @param    [浮点数]                   $num [字节]
 */
function F($num)
{
	if($num<1024){
		return $num."b";
	}elseif($num<pow(1024, 2)){
		return round($num/1024,2)."Kb";
	}elseif($num<pow(1024, 3)){
		return round($num/pow(1024, 2),2)."Mb";
	}elseif($num<pow(1024, 4)){
		return round($num/pow(1024,3),2)."Gb";
	}elseif($num<pow(1024, 5)){
		return round($num/pow(1024, 4),2)."Tb";
	}
}


function Fmkdir($path)
{
	if(!is_dir(dirname($path))){
		echo "目录不存在：".dirname($path)."<br>";
		Fmkdir(dirname($path));
	}

	echo "创建目录：".$path."<br>";
	mkdir($path);
}

/**
 * [C 读配置]
 * @Author   Xuebingsi
 * @DateTime 2017-07-25T08:27:01+0800
 * @param    string                   $value [description]
 */
function C($key)
{
	$configs = include COMMON_PATH.'/Config.php';
	if(isset($configs[$key])){
		return $configs[$key];
	}else{
		echo "该配置项不存在";
	}
}
/**
 * [M 实例化数据操作类]
 * @Author   Xuebingsi
 * @DateTime 2017-07-25T09:41:41+0800
 * @param    [type]                   $table [表名]
 */
function M($table='')
{
	return new Model($table);
}

function D($table)
{
	$table = ucfirst($table)."Model";
	return new $table;
}













 ?>